<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>绘制-直线-dashoffset</title>
    <style>
      body,
      ul {
        margin: 0;
        padding: 0;
      }

      body {
        background-image: url(../../images/grid.png);
      }
      svg {
        background-color: rgba(255, 0, 0, 0.1);
      }
    </style>
  </head>
  <body>
    <svg width="800" height="600">
      <!-- 
        dashoffset: 虚线偏移量
      -->
      <line
        x1="100"
        y1="100"
        x2="700"
        y2="100"
        stroke="red"
        stroke-width="10"
        stroke-dasharray="20 10"
        stroke-dashoffset="10"
      ></line>

      <polygon
        points="120 120 200 200 300 120"
        stroke="red"
        stroke-width="10"
        stroke-dasharray="20 10"
        stroke-dashoffset="10"
      ></polygon>

      <polyline
        points="200 180 300 290 400 180"
        stroke="red"
        stroke-width="10"
        stroke-dasharray="20 10"
        stroke-dashoffset="10"
      ></polyline>
    </svg>
  </body>
</html>
